/*
 * Metaverse Core
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */
package org.metaverse.warehouse;


/**
 * This is an interface for procedures to be 
 * performed over fetch results.
 * 
 * This interface provides a client with functional 
 * style for fetch-and-process pattern.
 * 
 * @author vjache
 * @see FetchSpecification
 * @see Fetcher
 */
public interface FetchProcedure extends FetchSpecification {
	/**
	 * This is a call back method invoked for each fetched result.
	 * @param aCursor - just a senary fetched.
	 * @return - 'true' if proceed traverse results and 'false' 
	 * if decided to stop traverse.
	 * @throws Exception
	 */
	boolean onNext(Senary aCursor) throws Exception;
	/**
	 * This is a call back method invoked when fetched results 
	 * finished to handle. Finish achieved when results exhausted 
	 * or method 'onNext' returned 'false'.
	 * @throws Exception
	 */
	void onFinish() throws Exception;
}
